﻿<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:Manhua2.Common"
    xmlns:contorls="using:Manhua2.Controls">

    <DataTemplate x:Key="ComicItemTemplate">
        <Grid HorizontalAlignment="Left" Width="135" Height="180">
            <Border Background="{StaticResource ListViewItemPlaceholderBackgroundThemeBrush}">
                <contorls:AsyncIcon />
                <!--<Image Source="{Binding Cover}" Stretch="UniformToFill" AutomationProperties.Name="{Binding Title}"/>-->
            </Border>
            <StackPanel VerticalAlignment="Bottom" Background="{StaticResource ListViewItemOverlayBackgroundThemeBrush}">
                <TextBlock Text="{Binding ComicTitle}" Foreground="{StaticResource ListViewItemOverlayForegroundThemeBrush}" Style="{StaticResource TitleTextStyle}" Height="25" Margin="15,0,0,0"/>
                <TextBlock Text="{Binding ChapterTitle}" Foreground="{StaticResource ListViewItemOverlaySecondaryForegroundThemeBrush}" Style="{StaticResource CaptionTextStyle}" TextWrapping="NoWrap" Margin="15,-5,0,0"/>
                <TextBlock Text="{Binding Timestamp}" Foreground="{StaticResource ListViewItemOverlaySecondaryForegroundThemeBrush}" Style="{StaticResource CaptionTextStyle}" TextWrapping="NoWrap" Margin="15,-5,0,0"/>
            </StackPanel>
            <ToolTipService.Placement>Mouse</ToolTipService.Placement>
            <ToolTipService.ToolTip>
                <ToolTip>
                    <ToolTip.Style>
                        <Style TargetType="ToolTip">
                            <Setter Property="BorderBrush" Value="{StaticResource ToolTipBackgroundThemeBrush}" />
                            <Setter Property="Padding" Value="0" />
                        </Style>
                    </ToolTip.Style>
                    <Grid Background="{StaticResource ApplicationPageBackgroundThemeBrush}">
                        <TextBlock Text="{Binding ComicTitle}" Style="{StaticResource TitleTextStyle}" Margin="0"  />
                        <TextBlock Text="{Binding ChapterTitle}" Style="{StaticResource CaptionTextStyle}" Margin="0,20,0,0" />
                        <TextBlock Text="{Binding Timestamp}" Style="{StaticResource CaptionTextStyle}" Margin="0,40,0,0" />
                    </Grid>
                </ToolTip>
            </ToolTipService.ToolTip>
        </Grid>
    </DataTemplate>

    <DataTemplate x:Key="ComicItemSnappedTemplate">
        <StackPanel Orientation="Horizontal" Width="290" Height="180">
            <Border Background="{StaticResource ListViewItemPlaceholderBackgroundThemeBrush}" 
                    Width="135" Height="180">
                <contorls:AsyncIcon />
            </Border>
            <StackPanel Orientation="Vertical" 
                        Background="{StaticResource ListViewItemOverlayBackgroundThemeBrush}"
                        Width="155" Height="180">
                <TextBlock Text="{Binding ComicTitle}" 
                           Foreground="{StaticResource ListViewItemOverlayForegroundThemeBrush}" 
                           Style="{StaticResource TitleTextStyle}" Height="25" TextWrapping="Wrap" />
                <TextBlock Text="{Binding ChapterTitle}" 
                           Foreground="{StaticResource ListViewItemOverlaySecondaryForegroundThemeBrush}" 
                           Style="{StaticResource CaptionTextStyle}" TextWrapping="Wrap" />
                <TextBlock Text="{Binding Timestamp}" 
                           Foreground="{StaticResource ListViewItemOverlaySecondaryForegroundThemeBrush}" 
                           Style="{StaticResource CaptionTextStyle}" TextWrapping="Wrap" />
            </StackPanel>
            <ToolTipService.Placement>Mouse</ToolTipService.Placement>
            <ToolTipService.ToolTip>
                <ToolTip>
                    <ToolTip.Style>
                        <Style TargetType="ToolTip">
                            <Setter Property="BorderBrush" Value="{StaticResource ToolTipBackgroundThemeBrush}" />
                            <Setter Property="Padding" Value="0" />
                        </Style>
                    </ToolTip.Style>
                    <Grid Background="{StaticResource ApplicationPageBackgroundThemeBrush}">
                        <TextBlock Text="{Binding ComicTitle}" Style="{StaticResource TitleTextStyle}" Margin="0"  />
                        <TextBlock Text="{Binding ChapterTitle}" Style="{StaticResource CaptionTextStyle}" Margin="0,20,0,0" />
                        <TextBlock Text="{Binding Timestamp}" Style="{StaticResource CaptionTextStyle}" Margin="0,40,0,0" />
                    </Grid>
                </ToolTip>
            </ToolTipService.ToolTip>
        </StackPanel>
    </DataTemplate>

    <DataTemplate x:Key="DownloadItemTemplate">
        <StackPanel Background="{StaticResource AppBarBorderThemeBrush}" Width="220" Height="75">
            <StackPanel Margin="5,4,0,0"  Background="Transparent" Orientation="Horizontal">
                <TextBlock Text="{Binding ComicTitle}" FontWeight="Bold" FontSize="16" />
                <TextBlock Text="{Binding ChapterTitle}" Margin="5,0"  FontSize="12" Foreground="{StaticResource ApplicationSecondaryForegroundThemeBrush}" />
            </StackPanel>
            <StackPanel Margin="5,0"  Background="Transparent" Orientation="Horizontal">
                <TextBlock Text="已经下载" FontSize="12" Foreground="{StaticResource ApplicationSecondaryForegroundThemeBrush}" />
                <TextBlock Text="{Binding CompletedPageCount}" FontSize="12" Foreground="{StaticResource ApplicationSecondaryForegroundThemeBrush}" Margin="2,0" />
                <TextBlock Text="页 共" FontSize="12" Foreground="{StaticResource ApplicationSecondaryForegroundThemeBrush}" />
                <TextBlock Text="{Binding TotalPageCount}" FontSize="12" Foreground="{StaticResource ApplicationSecondaryForegroundThemeBrush}" Margin="2,0" />
                <TextBlock Text="页" FontSize="12" Foreground="{StaticResource ApplicationSecondaryForegroundThemeBrush}" />
            </StackPanel>
            <StackPanel Margin="5,0" Background="Transparent" Orientation="Horizontal">
                <TextBlock Text="下载失败页数" FontSize="12" Foreground="{StaticResource ApplicationSecondaryForegroundThemeBrush}" />
                <TextBlock Text="{Binding FailedPageCount}" FontSize="12" Foreground="{StaticResource ApplicationSecondaryForegroundThemeBrush}" Margin="2,0" />
                <TextBlock Text="页" FontSize="12" Foreground="{StaticResource ApplicationSecondaryForegroundThemeBrush}" />
            </StackPanel>
            <StackPanel Margin="5,0" Background="Transparent" Orientation="Horizontal">
                <TextBlock Text="当前状态: " FontSize="12" Foreground="{StaticResource ApplicationSecondaryForegroundThemeBrush}" />
                <TextBlock Margin="5,0" Text="{Binding Status}" FontSize="12" Foreground="{StaticResource ApplicationSecondaryForegroundThemeBrush}" />
            </StackPanel>
        </StackPanel>
    </DataTemplate>
</ResourceDictionary>
